﻿using System.Collections.Generic;
using Yun.Interface;
using Yun.Item.Response;

namespace Yun.Item.Request
{
    /// <summary>
    /// 获取商品的浏览记录
    /// yun.item.browse.record.list
    /// </summary>
    public class GetItemBrowseRecordRequest : ITopRequest<GetItemBrowseRecordResponse>
    {
        /// <summary>
        /// 商品字段
        /// </summary>
        public string GoodsFields { get; set; }

        /// <summary>
        /// 页码
        /// </summary>
        public int PageNum
        {
            get { return _pageNum; }
            set { _pageNum = value < 1 ? 1 : value; }
        }

        private int _pageNum = 1;

        /// <summary>
        /// 页容量
        /// </summary>
        public int PageSize
        {
            get { return _pageSize; }
            set { _pageSize = value < 1 ? 1 : value; }
        }

        /// <summary>
        /// 是否需要促销的信息
        /// </summary>
        public bool NeedPromotion { get; set; }


        private int _pageSize = 1;


        public string GetApiName()
        {
            return "yun.item.browse.record.list";
        }

        public IDictionary<string, string> GetParameters()
        {
            var parameters = new YunDictionary
            {
                {"goodsfieids", GoodsFields},
                {"needpromotion", NeedPromotion},
                {"pagenum", PageNum},
                {"pagesize", PageSize}
            };
            return parameters;
        }

        public void Validate()
        {
        }
    }
}